/**
 * 
 */
package org.jft.datamodel.database.dao.implementation;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.Session;
import org.jft.datamodel.database.HibernateUtil;
import org.jft.datamodel.database.dao.GenericDAO;
import org.jft.datamodel.database.mapping.Photo;


/**
 * @author LAP
 *
 */
public class PhotoDAO extends GenericDAO<Photo> {

	@Override
	public Photo getByID(Long id) throws SQLException {
		Session session = HibernateUtil.getInstance().getSessionFactory().getCurrentSession();
		Photo photo = (Photo) session.load(Photo.class, id);
		return photo;
	}

	@Override
	public List<Photo> getAll() throws SQLException {
		Session session = HibernateUtil.getInstance().getSessionFactory().getCurrentSession();
		List<Photo> photos = session.createCriteria(Photo.class).list();
		return photos;
	}
	
}
